package com.hydroid.vds.vds;

import android.animation.AnimatorSet;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.PixelFormat;
import android.media.MediaActionSound;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;

import java.lang.reflect.Method;

/**
 * Created by luohy on 2018/5/4.
 */

class GlobalScreenShot {
    private static final String TAG = "GlobalScreenshot";
//
//    private static final int SCREENSHOT_FLASH_TO_PEAK_DURATION = 130;
//    private static final int SCREENSHOT_DROP_IN_DURATION = 430;
//    private static final int SCREENSHOT_DROP_OUT_DELAY = 500;
//    private static final int SCREENSHOT_DROP_OUT_DURATION = 430;
//    private static final int SCREENSHOT_DROP_OUT_SCALE_DURATION = 370;
//    private static final int SCREENSHOT_FAST_DROP_OUT_DURATION = 320;
//    private static final float BACKGROUND_ALPHA = 0.5f;
//    private static final float SCREENSHOT_SCALE = 1f;
//    private static final float SCREENSHOT_DROP_IN_MIN_SCALE = SCREENSHOT_SCALE * 0.725f;
//    private static final float SCREENSHOT_DROP_OUT_MIN_SCALE = SCREENSHOT_SCALE * 0.45f;
//    private static final float SCREENSHOT_FAST_DROP_OUT_MIN_SCALE = SCREENSHOT_SCALE * 0.6f;
//    private static final float SCREENSHOT_DROP_OUT_MIN_SCALE_OFFSET = 0f;
//
//    private Context mContext;
//    private WindowManager mWindowManager;
//    private WindowManager.LayoutParams mWindowLayoutParams;
//    private Display mDisplay;
//    private DisplayMetrics mDisplayMetrics;
//
//    private Bitmap mScreenBitmap;
//    private View mScreenshotLayout;
//    private ImageView mBackgroundView;
//    private ImageView mScreenshotView;
//    private ImageView mScreenshotFlash;
//
//    private AnimatorSet mScreenshotAnimation;
//
//    private float mBgPadding;
//    private float mBgPaddingScale;
//
//    private MediaActionSound mCameraSound;
//
//
//    /**
//     * @param context everything needs a context :(
//     */
//    public GlobalScreenshot(Context context) {
//        Resources r = context.getResources();
//        mContext = context;
//        LayoutInflater layoutInflater = (LayoutInflater)
//                context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//
//        // Inflate the screenshot layout
//        mScreenshotLayout = layoutInflater.inflate(R.layout.global_screenshot, null);
//        mBackgroundView = (ImageView) mScreenshotLayout.findViewById(R.id.global_screenshot_background);
//        mScreenshotView = (ImageView) mScreenshotLayout.findViewById(R.id.global_screenshot);
//        mScreenshotFlash = (ImageView) mScreenshotLayout.findViewById(R.id.global_screenshot_flash);
//        mScreenshotLayout.setFocusable(true);
//        mScreenshotLayout.setOnTouchListener(new View.OnTouchListener() {
//            @Override
//            public boolean onTouch(View v, MotionEvent event) {
//                // Intercept and ignore all touch events
//                return true;
//            }
//        });
//
//        // Setup the window that we are going to use
//        mWindowLayoutParams = new WindowManager.LayoutParams(
//                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 0, 0,
//                WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
//                WindowManager.LayoutParams.FLAG_FULLSCREEN
//                        | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
//                        | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
//                        | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED,
//                PixelFormat.TRANSLUCENT);
//        mWindowLayoutParams.setTitle("ScreenshotAnimation");
//        mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
//
//        mDisplay = mWindowManager.getDefaultDisplay();
//        mDisplayMetrics = new DisplayMetrics();
//        mDisplay.getRealMetrics(mDisplayMetrics);
//
//        // Scale has to account for both sides of the bg
//        mBgPadding = (float) r.getDimensionPixelSize(R.dimen.global_screenshot_bg_padding);
//        mBgPaddingScale = mBgPadding / mDisplayMetrics.widthPixels;
//
//        // Setup the Camera shutter sound
//        mCameraSound = new MediaActionSound();
//        mCameraSound.load(MediaActionSound.SHUTTER_CLICK);
//    }






}